package com.oneday.ashop.webgate.base.spring;

import com.oneday.ashop.core.entity.User;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import sun.security.krb5.Config;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
 * 登陆拦截器，用来判断用户是否登陆以及登陆是否过去
 * User:bob.yang
 * Date 2015/8/12 0012
 */
public class LoginInterceptor implements HandlerInterceptor{

    /**
     * 该方法会在处理器执行之前执行，可以用来预处理一些请求，返回true继续向下执行，返回false终端之后的所有方法
     * @param request
     * @param response
     * @param o
     * @return
     * @throws Exception
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
        System.out.print("");
        return true;
    }

    /**
     * 该方法需要prehandle方法返回true才会执行，这个方法执行的时间实在处理器处理之后，也就是control执行完，但是但dispatcherServlet渲染modelAndView之前
     * @param httpServletRequest
     * @param httpServletResponse
     * @param o
     * @param modelAndView
     * @throws Exception
     */
    @Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {

    }

    /**
     * 该方法同样需要prehandle方法返回true才会执行，但是他的执行时间实在dispatchServlet渲染modelAndView之后
     * @param httpServletRequest
     * @param httpServletResponse
     * @param o
     * @param e
     * @throws Exception
     */
    @Override
    public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {

    }
}
